home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 24 / CU Amiga Magazine's Super CD-ROM 24 (1998)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1998-07].iso / CUCD / Programming / SWI / source / src / pl-funcs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-04-15  |  25.9 KB  |  740 lines

  1. /*  $Id: pl-funcs.h,v 1.88 1998/04/15 15:17:03 jan Exp $
  2.  
  3.     Part of SWI-Prolog
  4.     Designed and implemented by Jan Wielemaker
  5.     E-mail: jan@swi.psy.uva.nl
  6.  
  7.     Copyright (C) 1994 University of Amsterdam. All rights reserved.
  8. */
  9.  
  10. #define unifyAtomic(p, w)    unify_atomic(p, (word)(w))
  11.  
  12. /* pl-alloc.c */
  13. void        free_heap(Void mem, size_t n);
  14. volatile void    outOf(Stack s);
  15. volatile void    outOfCore(void);
  16. Void        alloc_global(int n);
  17. Void        alloc_heap(size_t n);
  18. void        initMemAlloc(void);
  19. word        globalFunctor(functor_t def);
  20. int        sizeString(word w);
  21. word        globalString(const char *s);
  22. word        globalNString(long len, const char *s);
  23. Word        newTerm(void);
  24. word        globalReal(real f);
  25. word        globalLong(long i);
  26. double        valReal(word w);
  27. word        globalIndirect(word in);
  28. int        equalIndirect(word r1, word r2);
  29. word        globalIndirectFromCode(Code *PC);
  30. word        makeRef(Word p);
  31. #ifndef consPtr
  32. word        consPtr(void *p, int ts);
  33. #endif
  34. char *        store_string(const char *s);
  35. void        remove_string(char *s);
  36. int        unboundStringHashValue(const char *t);
  37. void *        xmalloc(size_t size);
  38. void *        xrealloc(void *mem, size_t size);
  39.  
  40. /* pl-wam.c */
  41. word        pl_count(void);
  42. bool        unify(Word t1, Word t2, LocalFrame env);
  43. bool        unify_ptrs(Word t1, Word t2);
  44. bool        can_unify(Word t1, Word t2);
  45. bool        unify_atomic(Word p, word a);
  46. word        pl_alt(term_t skip, word h);
  47. void        TrailAssignment(Word p);
  48. void        DoTrail(Word p);
  49. void        do_undo(mark *m);
  50. void        fix_term_ref_count(void);
  51.  
  52. /* pl-atom.c */
  53. word        lookupAtom(const char *s);
  54. word        pl_atom_hashstat(term_t i, term_t n);
  55. void        initAtoms(void);
  56. word        pl_current_atom(term_t a, word h);
  57. word        pl_complete_atom(term_t prefix, term_t common, term_t unique);
  58. word        pl_atom_completions(term_t prefix, term_t alts);
  59.  
  60. /* pl-arith.c */
  61.  
  62. word        pl_between(term_t l, term_t h, term_t n, word b);
  63. word        pl_succ(term_t n1, term_t n2);
  64. word        pl_plus(term_t a, term_t b, term_t c);
  65. int        ar_compare(Number n1, Number n2, int what);
  66. word        pl_lessNumbers(term_t n1, term_t n2);
  67. word        pl_greaterNumbers(term_t n1, term_t n2);
  68. word        pl_lessEqualNumbers(term_t n1, term_t n2);
  69. word        pl_greaterEqualNumbers(term_t n1, term_t n2);
  70. word        pl_nonEqualNumbers(term_t n1, term_t n2);
  71. word        pl_equalNumbers(term_t n1, term_t n2);
  72. word        pl_is(term_t v, term_t e);
  73. word        pl_arithmetic_function(term_t descr);
  74. word        pl_current_arithmetic_function(term_t f, word h);
  75. void        initArith(void);
  76. int        indexArithFunction(functor_t fdef, Module m);
  77. functor_t    functorArithFunction(int n);
  78. bool        ar_func_n(code n, int argc, Number *stack);
  79. int        valueExpression(term_t p, Number n);
  80. int        toIntegerNumber(Number n);
  81. void        canoniseNumber(Number n);
  82.  
  83. /* pl-bag.c */
  84. word        pl_record_bag(term_t term);
  85. int         checkBags(void);
  86. word        pl_collect_bag(term_t bindings, term_t bag);
  87.  
  88. /* pl-comp.c */
  89. void        initWamTable(void);
  90. int        get_head_and_body_clause(term_t clause,
  91.                      term_t head, term_t body, Module *m);
  92. Clause        assert_term(term_t term, int where, SourceLoc loc);
  93. word        pl_assertz(term_t term);
  94. word        pl_asserta(term_t term);
  95. word        pl_assertz2(term_t term, term_t ref);
  96. word        pl_asserta2(term_t term, term_t ref);
  97. word        pl_record_clause(term_t term, term_t file, term_t ref);
  98. word        pl_redefine_system_predicate(term_t term);
  99. bool        decompileHead(Clause clause, term_t head);
  100. int        arg1Key(Clause clause, word *key);
  101. bool        decompile(Clause clause, term_t term, term_t bindings);
  102. word        pl_clause4(term_t p, term_t t, term_t ref, term_t b, word h);
  103. word        pl_clause(term_t p, term_t term, term_t ref, word h);
  104. word        pl_nth_clause(term_t p, term_t n, term_t ref, word h);
  105. word        pl_xr_member(term_t ref, term_t term, word h);
  106. void        wamListClause(Clause clause);
  107. word        pl_wam_list(term_t ref);
  108. word        pl_fetch_vm(term_t ref, term_t offset, term_t noffset,
  109.                 term_t instruction);
  110. int        unify_definition(term_t head, Definition def,
  111.                  term_t thehead, int flags);
  112. word        pl_clause_term_position(term_t ref, term_t pc, term_t locterm);
  113. word        pl_break_pc(term_t ref, term_t pc, term_t nextpc, control_t h);
  114. word        pl_break_at(term_t ref, term_t pc, term_t set);
  115. code        replacedBreak(Code PC);
  116. void        clearBreakPointsClause(Clause clause);
  117. word        pl_current_break(term_t ref, term_t pc, control_t h);
  118.  
  119. /* pl-dump.c */
  120. word        saveProgram(term_t new);
  121. word        pl_save_program(term_t new, term_t args);
  122. word        pl_save(term_t file, term_t restore);
  123. word        pl_restore(term_t file);
  124. word        parseSaveProgramOptions(term_t args,
  125.             int *local, int *global, int *trail, int *argument,
  126.             char **goal, char **toplevel, char **init_file,
  127.             bool *tty, bool *standalone);
  128.  
  129. /* pl-index.c */
  130. int        cardinalityPattern(unsigned long pattern);
  131. void        getIndex(Word argv, unsigned long pattern, int card,
  132.              struct index *);
  133. ClauseRef    findClause(ClauseRef cl,
  134.                Word argv, Definition def, bool *deterministic);
  135. bool        reindexClause(Clause clause);
  136. bool        unify_index_pattern(Procedure proc, term_t value);
  137. bool        hashDefinition(Definition def, int buckets);
  138. word        pl_hash(term_t pred);
  139. void        addClauseToIndex(Definition def, Clause cl, int where);
  140. void        delClauseFromIndex(ClauseIndex ci, Clause cl);
  141. void        gcClauseIndex(ClauseIndex ci);
  142. void        unallocClauseIndexTable(ClauseIndex ci);
  143. void        markDirtyClauseIndex(ClauseIndex ci, Clause cl);
  144.  
  145. /* pl-dwim.c */
  146. word        pl_dwim_match(term_t a1, term_t a2, term_t mm);
  147. word        pl_dwim_predicate(term_t term, term_t dwim, word h);
  148.  
  149. /* pl-ext.c */
  150. void        initBuildIns(void);
  151.  
  152. /* pl-error.c */
  153.  
  154. int        PL_error(const char *pred, int arity, const char *msg,
  155.              int id, ...);
  156. char *        tostr(char *buf, const char *fmt, ...);
  157.  
  158. /* pl-file.c */
  159. void        initIO(void);
  160. void        dieIO(void);
  161. void        closeFiles(int all);
  162. void        protocol(char *s, int n);
  163. int        currentLinePosition(void);
  164. void        setCurrentSourceLocation(void);
  165. int        getSingleChar(void);
  166. word        pl_rawtty(term_t goal);
  167. bool        readLine(char *buffer);
  168. bool        LockStream(void);
  169. bool        UnlockStream(void);
  170. bool        Put(int c);
  171. bool        PutOpenToken(int c);
  172. word        pl_dup_stream(term_t from, term_t to);
  173. IOSTREAM *    PL_current_input(void);
  174. IOSTREAM *    PL_current_output(void);
  175. word        Putf(char *fm, ...);
  176. bool        Puts(const char *str);
  177. word        pl_told(void);
  178. word        pl_flush(void);
  179. word        pl_see(term_t f);
  180. word        pl_seen(void);
  181. word        pl_noprotocol(void);
  182. bool        seeString(char *s);
  183. bool        seeingString(void);
  184. bool        seenString(void);
  185. bool        tellString(char **s, int size);
  186. bool        toldString(void);
  187. atom_t        currentStreamName(void);
  188. word        pl_wait_for_input(term_t streams, term_t avail, term_t tmo);
  189. word        pl_put(term_t c);
  190. word        pl_put2(term_t stream, term_t chr);
  191. word        pl_get(term_t chr);
  192. word        pl_skip(term_t chr);
  193. word        pl_skip2(term_t stream, term_t chr);
  194. word        pl_get2(term_t stream, term_t chr);
  195. word        pl_tty(void);
  196. word        pl_get_single_char(term_t c);
  197. word        pl_get0(term_t c);
  198. word        pl_get02(term_t stream, term_t c);
  199. word        pl_seeing(term_t f);
  200. word        pl_telling(term_t f);
  201. word        pl_tell(term_t f);
  202. word        pl_append(term_t f);
  203. word        pl_ttyflush(void);
  204. word        pl_protocol(term_t file);
  205. word        pl_protocola(term_t file);
  206. word        pl_protocolling(term_t file);
  207. word        pl_prompt(term_t old, term_t new);
  208. void        prompt1(char *prompt);
  209. word        pl_prompt1(term_t prompt);
  210. word        pl_tab(term_t n);
  211. char *        PrologPrompt(void);
  212. word        pl_tab2(term_t stream, term_t n);
  213. word        pl_open4(term_t file, term_t mode, term_t stream, term_t opt);
  214. word        pl_open(term_t file, term_t mode, term_t stream);
  215. word        pl_open_null_stream(term_t stream);
  216. int        streamNo(term_t spec, int mode);
  217. word        pl_close(term_t stream);
  218. word        pl_current_stream(term_t file, term_t mode, term_t s, word h);
  219. word        pl_flush_output(term_t stream);
  220. word        pl_stream_position(term_t stream, term_t old, term_t new);
  221. word        pl_set_input(term_t stream);
  222. word        pl_set_output(term_t stream);
  223. word        pl_current_input(term_t stream);
  224. word        pl_current_output(term_t stream);
  225. word        pl_character_count(term_t stream, term_t count);
  226. word        pl_line_count(term_t stream, term_t count);
  227. word        pl_line_position(term_t stream, term_t count);
  228. word        pl_source_location(term_t file, term_t line);
  229. word        pl_at_end_of_stream1(term_t stream);
  230. word        pl_at_end_of_stream0();
  231. word        pl_peek_byte2(term_t stream, term_t chr);
  232. word        pl_peek_byte1(term_t chr);
  233. bool        unifyTime(term_t t, long time);
  234. word        pl_time_file(term_t name, term_t t);
  235. word        pl_size_file(term_t name, term_t len);
  236. word        pl_access_file(term_t name, term_t mode);
  237. word        pl_read_link(term_t file, term_t link, term_t to);
  238. word        pl_exists_file(term_t name);
  239. word        pl_exists_directory(term_t name);
  240. word        pl_tmp_file(term_t base, term_t name);
  241. word        pl_delete_file(term_t name);
  242. word        pl_same_file(term_t file1, term_t file2);
  243. word        pl_rename_file(term_t old, term_t new);
  244. word        pl_fileerrors(term_t old, term_t new);
  245. word        pl_absolute_file_name(term_t name, term_t expanded);
  246. word        pl_is_absolute_file_name(term_t name);
  247. word        pl_chdir(term_t dir);
  248. word        pl_file_base_name(term_t f, term_t b);
  249. word        pl_file_dir_name(term_t f, term_t b);
  250. word        pl_file_name_extension(term_t base, term_t ext, term_t full);
  251. word        pl_prolog_to_os_filename(term_t pl, term_t os);
  252. #ifdef __WIN32__
  253. word        pl_make_fat_filemap(term_t dir);
  254. #endif
  255.  
  256. /* pl-flag.c */
  257. void        initFlags(void);
  258. word        pl_flag(term_t name, term_t old, term_t new);
  259. word        pl_current_flag(term_t k, word h);
  260.  
  261. /* pl-fli.c */
  262. word        makeNum(long i);
  263. void        finish_foreign_frame();
  264. void        _PL_put_number(term_t t, Number n);
  265. int        _PL_unify_number(term_t t, Number n);
  266. predicate_t    _PL_predicate(const char *name, int arity, const char *module,
  267.                   predicate_t *bin);
  268. void        initialiseForeign(int argc, char **argv);
  269. char *        buffer_string(const char *s, int flags);
  270.  
  271. /* pl-fmt.c */
  272. word        pl_format_predicate(term_t chr, term_t descr);
  273. word        pl_format(term_t fmt, term_t args);
  274. word        pl_format3(term_t s, term_t fmt, term_t args);
  275.  
  276. /* pl-funct.c */
  277. functor_t    lookupFunctorDef(atom_t atom, int arity);
  278. functor_t    isCurrentFunctor(atom_t atom, int arity);
  279. void        initFunctors(void);
  280. int         checkFunctors(void);
  281. word        pl_current_functor(term_t name, term_t arity, word h);
  282.  
  283. /* pl-gc.c */
  284. void        considerGarbageCollect(Stack s);
  285. void        garbageCollect(LocalFrame fr);
  286. word        pl_garbage_collect(term_t d);
  287. void        resetGC(void);
  288. Word        findGRef(int n);
  289. int        growStacks(LocalFrame fr, Code PC, int l, int g, int t);
  290. void        clearUninitialisedVarsFrame(LocalFrame, Code);
  291. word        check_foreign(void);    /* O_SECURE stuff */
  292.  
  293.  
  294. /* pl-glob.c */
  295. word        pl_wildcard_match(term_t pattern, term_t string);
  296. word        pl_expand_file_name(term_t f, term_t l);
  297.  
  298. /* pl-itf.c */
  299. void        resetForeign(void);
  300.  
  301. /* pl-list.c */
  302. word        pl_is_list(term_t list);
  303. word        pl_proper_list(term_t list);
  304. word        pl_length(term_t list, term_t l);
  305. word        pl_memberchk(term_t e, term_t list);
  306. word        pl_msort(term_t list, term_t sorted);
  307. word        pl_sort(term_t list, term_t sorted);
  308.  
  309. /* pl-load.c */
  310. bool        getSymbols(void);
  311. void        resetLoader(void);
  312. long        allocText(long int size);
  313. word        pl_load_foreign(term_t file, term_t entry, term_t options,
  314.                 term_t libraries, term_t size);
  315. word        pl_load_foreign1(term_t file);
  316. word        pl_open_shared_object(term_t file, term_t h, term_t flags);
  317. word        pl_close_shared_object(term_t plhandle);
  318. word        pl_call_shared_object_function(term_t plhandle, term_t name);
  319. word        pl_load_shared_object(term_t file, term_t entry);
  320.  
  321. /* pl-modul.c */
  322. Module        lookupModule(atom_t name);
  323. void        initModules(void);
  324. int        isSuperModule(Module s, Module m);
  325. Word        stripModule(Word term, Module *module);
  326. bool        isPublicModule(Module module, Procedure proc);
  327. int        declareModule(atom_t name, SourceFile sf);
  328. word        pl_default_module(term_t me, term_t old, term_t new);
  329. word        pl_current_module(term_t module, term_t file, word h);
  330. word        pl_strip_module(term_t spec, term_t module, term_t term);
  331. word        pl_module(term_t old, term_t new);
  332. word        pl_set_source_module(term_t old, term_t new);
  333. word        pl_term_expansion_module(term_t name, word h);
  334. word        pl_declare_module(term_t name, term_t file);
  335. word        pl_export_list(term_t modulename, term_t list);
  336. word        pl_export(term_t head);
  337. word        pl_check_export(void);
  338. word        pl_context_module(term_t module);
  339. word        pl_import(term_t pred);
  340.  
  341. /* pl-op.c */
  342. Operator    isCurrentOperator(atom_t name, int type);
  343. word        pl_current_op(term_t prec, term_t type, term_t name, word h);
  344. bool        isPrefixOperator(atom_t atom, int *type, int *priority);
  345. bool        isPostfixOperator(atom_t atom, int *type, int *priority);
  346. bool        isInfixOperator(atom_t atom, int *type, int *priority);
  347. word        pl_op1(term_t priority, term_t type, term_t name);
  348. bool        newOp(char *name, int type, int pri);
  349. void        initOperators(void);
  350. word        pl_reset_operators(void);
  351.  
  352. /* pl-os.c */
  353. bool        initOs(void);
  354. volatile void    Halt(int status);
  355. char *        OsError(void);
  356. real        CpuTime(void);
  357. Void        Allocate(long int n);
  358. long        Random(void);
  359. char *        canonisePath(char *path);
  360. char *        OsPath(const char *plpath, char *ospath);
  361. char *        PrologPath(const char *ospath, char *plpath);
  362. long        LastModifiedFile(char *f);
  363. bool        ExistsFile(const char *path);
  364. bool        AccessFile(const char *path, int mode);
  365. bool        ExistsDirectory(const char *path);
  366. long        SizeFile(const char *path);
  367. int        RemoveFile(const char *path);
  368. bool        RenameFile(const char *old, const char *new);
  369. bool        SameFile(const char *f1, const char *f2);
  370. bool        OpenStream(int fd);
  371. bool        MarkExecutable(const char *name);
  372. bool        expandVars(const char *pattern, char *expanded);
  373. char *        ExpandOneFile(const char *spec, char *file);
  374. char *        getwd(char *buf);
  375. char *        AbsoluteFile(const char *spec, char *path);
  376. int        IsAbsolutePath(const char *spec);
  377. char *        BaseName(char *f);
  378. char *        DirName(const char *f, char *buf);
  379. char *        ReadLink(const char *f, char *buf);
  380. char *        DeRefLink(const char *link, char *buf);
  381. bool        ChDir(const char *path);
  382. atom_t        TemporaryFile(const char *id);
  383. struct tm *    LocalTime(long int *t);
  384. Char        GetChar(void);
  385. void        ResetTty(void);
  386. bool        PushTty(ttybuf *buf, int mode);
  387. bool        PopTty(ttybuf *buf);
  388. char *        getenv3(const char *, char *buf, int buflen);
  389. int        getenvl(const char *);
  390. int        Setenv(char *name, char *value);
  391. int        Unsetenv(char *name);
  392. int        System(char *cmd);
  393. char *        Symbols(char *buf);
  394. void        Pause(real time);
  395. #if __WIN32__
  396. int        iswin32s(void);
  397. #endif /*__WIN32__*/
  398.  
  399. /* pl-prims.c */
  400. word        pl_nonvar(term_t k);
  401. word        pl_var(term_t k);
  402. word        pl_integer(term_t k);
  403. word        pl_float(term_t k);
  404. word        pl_string(term_t k);
  405. word        pl_number(term_t k);
  406. word        pl_atom(term_t k);
  407. word        pl_atomic(term_t k);
  408. word        pl_ground(term_t term);
  409. word        pl_compound(term_t term);
  410. #ifdef O_HASHTERM
  411. word        pl_hash_term(term_t term, term_t hval);
  412. #endif
  413. word        pl_unify(term_t t1, term_t t2);
  414. word        pl_notunify(term_t t1, term_t t2);
  415. word        pl_equal(term_t t1, term_t t2);
  416. word        pl_nonequal(term_t t1, term_t t2);
  417. int        compareStandard(Word t1, Word t2);
  418. word        pl_compare(term_t rel, term_t t1, term_t t2);
  419. word        pl_lessStandard(term_t t1, term_t t2);
  420. word        pl_lessEqualStandard(term_t t1, term_t t2);
  421. word        pl_greaterStandard(term_t t1, term_t t2);
  422. word        pl_greaterEqualStandard(term_t t1, term_t t2);
  423. word        pl_structural_equal(term_t t1, term_t t2);
  424. word        pl_structural_nonequal(term_t t1, term_t t2);
  425. word        pl_functor(term_t t, term_t f, term_t a);
  426. word        pl_arg(term_t n, term_t t, term_t a, word b);
  427. word        pl_setarg(term_t n, term_t term, term_t arg);
  428. int        lengthList(term_t list);
  429. word        pl_univ(term_t t, term_t l);
  430. int        numberVars(term_t t, functor_t functor, int n);
  431. word        pl_numbervars(term_t t, term_t atom,
  432.                   term_t start, term_t end);
  433. word        pl_free_variables(term_t t, term_t l);
  434. word        pl_e_free_variables(term_t t, term_t l);
  435. word        pl_copy_term(term_t f, term_t t);
  436. word        stringToList(char *s);
  437. word        pl_atom_length(term_t w, term_t n);
  438. word        pl_int_to_atom(term_t number, term_t base,
  439.                    term_t atom);
  440. char *        formatInteger(bool split, int div, int radix,
  441.                   bool small, long n, char *out);
  442. word        pl_format_number(term_t format, term_t number,
  443.                  term_t string);
  444. word        pl_name(term_t atom, term_t string);
  445. word        pl_atom_chars(term_t atom, term_t string);
  446. word        pl_number_chars(term_t number, term_t string);
  447. word        pl_atom_char(term_t atom, term_t chr);
  448. word        pl_atom_prefix(term_t atom, term_t prefix);
  449. word        pl_concat(term_t a1, term_t a2, term_t a3);
  450. word        pl_concat_atom(term_t list, term_t atom);
  451. word        pl_concat_atom3(term_t list, term_t sep, term_t atom);
  452. word        pl_apropos_match(term_t a1, term_t a2);
  453. word        pl_string_length(term_t str, term_t l);
  454. word        pl_string_concat(term_t a1, term_t a2, term_t a3, word h);
  455. word        pl_string_to_atom(term_t str, term_t a);
  456. word        pl_string_to_list(term_t str, term_t list);
  457. word        pl_substring(term_t str, term_t offset,
  458.                  term_t length, term_t sub);
  459. word        pl_write_on_atom(term_t goal, term_t atom);
  460. word        pl_write_on_string(term_t goal, term_t string);
  461. word        pl_write_on_list(term_t goal, term_t string);
  462. word        pl_term_to_atom(term_t term, term_t atom,
  463.                 term_t bindings, term_t e);
  464. word        pl_repeat(word h);
  465. word        pl_fail(void);
  466. word        pl_true(void);
  467. word        pl_halt(term_t code);
  468. word        pl_statistics(term_t k, term_t value);
  469. int        setFeature(atom_t name, int type, ...);
  470. void        CSetFeature(char *name, char *value);
  471. word        pl_feature(term_t key, term_t value, word h);
  472. word        pl_set_feature(term_t key, term_t value);
  473. word        pl_option(term_t key, term_t old, term_t new);
  474. word        pl_please(term_t key, term_t old, term_t new);
  475. word        pl_style_check(term_t old, term_t new);
  476. word        pl_novice(term_t old, term_t new);
  477.  
  478. /* pl-pro.c */
  479. word        pl_break(void);
  480. word        pl_break1(term_t goal);
  481. word        pl_notrace1(term_t goal);
  482. #ifdef O_LIMIT_DEPTH
  483. word        pl_depth_limit(term_t limit, term_t olimit, term_t oreached);
  484. word        pl_depth_limit_true(term_t limit,
  485.                     term_t olimit, term_t oreached,
  486.                     term_t res, term_t cut, word b);
  487. word        pl_depth_limit_false(term_t limit,
  488.                      term_t olimit, term_t oreached,
  489.                      term_t res);
  490. #endif /*O_LIMIT_DEPTH*/
  491. int        callProlog(Module module, term_t goal, int debug);
  492. word        pl_abort(void);
  493. bool        prolog(atom_t toplevel);
  494. word        pl_metacut(void);
  495. int         trap_gdb(void);
  496. word        checkData(Word p);
  497.  
  498. /* pl-proc.c */
  499. Procedure    lookupProcedure(functor_t f, Module m);
  500. Procedure    isCurrentProcedure(functor_t f, Module m);
  501. Procedure    lookupProcedureToDefine(functor_t def, Module m);
  502. bool        isDefinedProcedure(Procedure proc);
  503. int        get_procedure(term_t descr, Procedure *proc, term_t he, int f);
  504. word        pl_current_predicate(term_t name, term_t functor, word h);
  505. bool        assertProcedure(Procedure proc, Clause clause, int where);
  506. bool        abolishProcedure(Procedure proc, Module module);
  507. bool        retractClauseProcedure(Procedure proc, Clause clause);
  508. void        freeClause(Clause c);
  509. void        freeClauseRef(ClauseRef c);
  510. ClauseRef    newClauseRef(Clause cl);
  511. void        gcClausesDefinition(Definition def);
  512. void        resetReferences(void);
  513. Procedure    resolveProcedure(functor_t f, Module module);
  514. Definition    trapUndefined(Definition def);
  515. word        pl_retract(term_t term, word h);
  516. word        pl_retractall(term_t head);
  517. word        pl_abolish(term_t atom, term_t arity);
  518. word        pl_abolish1(term_t pred);
  519. word        pl_get_clause_attribute(term_t ref, term_t att, term_t value);
  520. word        pl_get_predicate_attribute(term_t pred, term_t k, term_t v);
  521. word        pl_set_predicate_attribute(term_t pred, term_t k, term_t v);
  522. void        reindexDefinition(Definition def);
  523. void        startConsult(SourceFile f);
  524. word        pl_index(term_t pred);
  525. SourceFile    lookupSourceFile(atom_t name);
  526. void        addProcedureSourceFile(SourceFile sf, Procedure proc);
  527. word        pl_make_system_source_files(void);
  528. word        pl_source_file(term_t descr, term_t file, control_t h);
  529. word        pl_time_source_file(term_t file, term_t t, control_t h);
  530. word        pl_start_consult(term_t file);
  531. word        pl_default_predicate(term_t d1, term_t d2);
  532. Definition    autoImport(functor_t f, Module m);
  533. word        pl_require(term_t pred);
  534. word        pl_check_definition(term_t spec);
  535. word        pl_clause_from_source(term_t file, term_t line, term_t clause);
  536.  
  537. /* pl-prof.c */
  538. void        stopItimer(void);
  539. word        pl_profile(term_t old, term_t new);
  540. word        pl_profile_count(term_t head, term_t calls, term_t prom);
  541. word        pl_profile_box(term_t head,
  542.                    term_t calls, term_t redos,
  543.                    term_t exits, term_t fails);
  544. word        pl_reset_profiler(void);
  545.  
  546. /* pl-read.c */
  547. void        resetRead(void);
  548. int        syntaxerrors(int new);
  549. word        pl_syntaxerrors(term_t old, term_t new);
  550. int        get_number(const unsigned char *string,
  551.                unsigned char **end,
  552.                Number value);
  553. word        pl_raw_read(term_t term);
  554. word        pl_raw_read2(term_t stream, term_t term);
  555. word        pl_read_variables(term_t term, term_t variables);
  556. word        pl_read_variables3(term_t stream, term_t term,
  557.                    term_t variables);
  558. word        pl_read(term_t term);
  559. word        pl_read2(term_t stream, term_t term);
  560. word        pl_read_clause(term_t term);
  561. word        pl_read_clause2(term_t stream, term_t term);
  562. word        pl_read_term(term_t term, term_t pos);
  563. word        pl_read_term3(term_t stream, term_t term, term_t pos);
  564.  
  565. /* pl-rec.c */
  566. void        initRecords(void);
  567. Record        compileTermToHeap(term_t term);
  568. void        copyRecordToGlobal(term_t copy, Record term);
  569. int        structuralEqualArg1OfRecord(term_t t, Record r);
  570. bool        freeRecord(Record record);
  571. bool        unifyKey(term_t key, word val);
  572. word        getKey(term_t key);
  573. word        pl_current_key(term_t k, word h);
  574. word        pl_recorda(term_t key, term_t term, term_t ref);
  575. word        pl_recordz(term_t key, term_t term, term_t ref);
  576. word        pl_recorded(term_t key, term_t term, term_t ref, word h);
  577. word        pl_erase(term_t ref);
  578.  
  579. /* pl-rl.c */
  580. void        install_rl(void);
  581.  
  582. /* pl-setup.c */
  583. void        setupProlog(void);
  584. handler_t    pl_signal(int sig, handler_t func);
  585. void        resetSignals(void);
  586. void        handleSignals(void);
  587. void        deliverSignal(int sig, int tp, SignalContext scp, char *addr);
  588. void        deallocateStacks(void);
  589. bool        restoreStack(Stack s);
  590. void        trimStacks(void);
  591. void        resetStacks(void);
  592. void        emptyStacks(void);
  593. word        pl_trim_stacks(void);
  594. word        pl_limit_stack(term_t s, term_t l);
  595. word        pl_stack_parameter(term_t s, term_t k, term_t o, term_t n);
  596. void        ensureRoomStack(Stack s, int n);
  597.  
  598.  
  599. /* pl-sys.c */
  600. word        pl_shell(term_t command, term_t status);
  601. word        pl_getenv(term_t var, term_t value);
  602. word        pl_setenv(term_t var, term_t value);
  603. word        pl_unsetenv(term_t var);
  604. word        pl_argv(term_t list);
  605. word        pl_convert_time(term_t time, term_t year,
  606.                 term_t month, term_t day,
  607.                 term_t hour, term_t minute,
  608.                 term_t second, term_t usec);
  609. word        pl_get_time(term_t t);
  610. word        pl_sleep(term_t time);
  611.  
  612. /* pl-table.c */
  613. Table        newHTable(int size);
  614. void        destroyHTable(Table ht);
  615. Symbol        lookupHTable(Table ht, Void name);
  616. bool        addHTable(Table ht, Void name, Void value);
  617. void        deleteSymbolHTable(Table ht, Symbol s);
  618. Symbol        nextHTable(Table ht, Symbol s);
  619. Symbol        firstHTable(Table ht);
  620. void        clearHTable(Table ht);
  621. void        initTables();
  622.  
  623. /* pl-trace.c */
  624. int        tracePort(LocalFrame frame, LocalFrame bfr, int port, Code PC);
  625. void        backTrace(LocalFrame frame, int depth);
  626. word        pl_trace_continuation(term_t what);
  627. void        initTracer(void);
  628. void        resetTracer(void);
  629. int        tracemode(int new, int *old);
  630. int        debugmode(int new, int *old);
  631. word        pl_trace(void);
  632. word        pl_notrace(void);
  633. word        pl_tracing(void);
  634. word        pl_debug(void);
  635. word        pl_nodebug(void);
  636. word        pl_debugging(void);
  637. word        pl_skip_level(term_t old, term_t new);
  638. word        pl_spy(term_t p);
  639. word        pl_nospy(term_t p);
  640. word        pl_leash(term_t old, term_t new);
  641. word        pl_visible(term_t old, term_t new);
  642. word        pl_debuglevel(term_t old, term_t new);
  643. word        pl_unknown(term_t old, term_t new);
  644. word        pl_prolog_current_frame(term_t fr);
  645. word        pl_prolog_frame_attribute(term_t fr, term_t key, term_t val);
  646. void        callEventHook(int ev, ...);
  647.  
  648. /* pl-util.c */
  649. char        digitName(int n, bool small);
  650. int        digitValue(int b, int c);
  651. char *        procedureName(Procedure proc);
  652. char *        predicateName(Definition def);
  653. word        notImplemented(char *name, int arity);
  654. word        setBoolean(int *flag, const char *name, term_t o, term_t n);
  655. word        setInteger(int *val, const char *name, term_t old, term_t new);
  656. word        setLong(long *val, const char *name, term_t old, term_t new);
  657. bool        strprefix(char *string, char *prefix);
  658. bool        strpostfix(char *string, char *postfix);
  659. bool        stripostfix(const char *string, const char *postfix);
  660. void        systemMode(bool accept);
  661. bool        scan_options(term_t list, int flags, atom_t name,
  662.                  const opt_spec *specs, ...);
  663. #ifndef HAVE_STRICMP
  664. int        stricmp(const char *s1, const char *s2);
  665. #endif
  666. #ifndef HAVE_STRLWR
  667. char *        strlwr(char *s);
  668. #endif
  669.  
  670. /* pl-wic.c */
  671. bool        loadWicFile(char *file, int flags);
  672. word        pl_open_wic(term_t name, term_t options);
  673. word        pl_close_wic(void);
  674. word        pl_add_directive_wic(term_t term);
  675. word        pl_import_wic(term_t module, term_t head);
  676. bool        compileFileList(char *out, int argc, char **argv);
  677. void        qlfCleanup(void);
  678.  
  679. word        pl_qlf_put_states(void);
  680. word        pl_qlf_start_module(term_t name);
  681. word        pl_qlf_start_sub_module(term_t name);
  682. word        pl_qlf_start_file(term_t name);
  683. word        pl_qlf_end_part(void);
  684. word        pl_qlf_open(term_t file);
  685. word        pl_qlf_close(void);
  686. word        pl_qlf_load(term_t file, term_t module);
  687. word        pl_qlf_assert_clause(term_t ref);
  688. word        pl_qlf_info(term_t file, term_t cvers, term_t fvers, term_t i);
  689.  
  690. /* pl-write.c */
  691. char *        varName(term_t var, char *buf);
  692. word        pl_nl(void);
  693. word        pl_nl1(term_t stream);
  694. word        pl_write_canonical(term_t term);
  695. word        pl_write_canonical2(term_t stream, term_t term);
  696. word        pl_write_term(term_t term, term_t options);
  697. word        pl_write_term3(term_t stream,
  698.                    term_t term, term_t options);
  699. word        pl_write(term_t term);
  700. word        pl_writeq(term_t term);
  701. word        pl_print(term_t term);
  702. word        pl_write2(term_t stream, term_t term);
  703. word        pl_writeq2(term_t stream, term_t term);
  704. word        pl_print2(term_t stream, term_t term);
  705.  
  706. /* pl-term.c */
  707. void        resetTerm(void);
  708. word        pl_tty_get_capability(term_t name, term_t type, term_t value);
  709. word        pl_tty_goto(term_t x, term_t y);
  710. word        pl_tty_put(term_t a, term_t affcnt);
  711. word        pl_set_tty(term_t old, term_t new);
  712.  
  713. /* pl-main.c */
  714. int        startProlog(int argc, char **argv);
  715. bool        sysError(const char *fm, ...);
  716. bool        fatalError(const char *fm, ...);
  717. bool        warning(const char *fm, ...);
  718. bool        vfatalError(const char *fm, va_list args);
  719. bool        vwarning(const char *fm, va_list args);
  720.  
  721. /* pl-dde.c */
  722.  
  723. word        pl_open_dde_conversation(term_t serv, term_t top, term_t hdl);
  724. word        pl_close_dde_conversation(term_t handle);
  725. word        pl_dde_request(term_t h, term_t it, term_t value, term_t tmo);
  726. word        pl_dde_execute(term_t handle, term_t cmd, term_t tmo);
  727. word        pl_dde_register_service(term_t service, term_t onoff);
  728. word        pl_dde_poke(term_t h, term_t item, term_t data, term_t tmo);
  729.  
  730. /* pl-dll.c */
  731. word        pl_open_dll(term_t name, term_t handle);
  732. word        pl_close_dll(term_t handle);
  733. word        pl_call_dll_function(term_t handle, term_t funcname);
  734.  
  735. /* pl-nt.c */
  736.  
  737. void        PlMessage(const char *buf, ...);
  738. word        pl_window_title(term_t old, term_t new);
  739. word        pl_win_exec(term_t command, term_t show);
  740.